package com.minew.beaconset.bean;

import com.minew.beaconset.db.annotation.Id;
import com.minew.beaconset.db.annotation.NoAutoIncrement;
import com.minew.beaconset.db.annotation.Table;
import com.minew.beaconset.utils.DateUtil;

import java.util.Date;

/**
 * 定位记录表
 */
@Table
public class LocaltionLog {
    @Id
    @NoAutoIncrement
    private String id ;
    private String name;
    private String mac;
    private int battery;//电量
    private float distance;//距离

    private int rssi;

    private int type ;//0 进入 1 停留 2 离开
    public static final int TYPE_IN = 0;
    public static final int TYPE_ACTIVITY = 1;
    public static final int TYPE_OUT = 2;

    private Date createDate;//当前时间

    public int getRssi() {
        return rssi;
    }

    public void setRssi(int rssi) {
        this.rssi = rssi;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public int getBattery() {
        return battery;
    }

    public void setBattery(int battery) {
        this.battery = battery;
    }

    public float getDistance() {
        return distance;
    }

    public void setDistance(float distance) {
        this.distance = distance;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String toString(){
        String msg = "";
        msg+="\n记录ID:"+id;
        msg+="\nMAC:"+mac;
        msg+="\n名称:"+name;
        msg+="\n电量:"+battery;
        msg+="\n距离:"+distance+"米";
        msg+="\n类型:";
        switch (type){
            case TYPE_IN:
                msg+="进入";
                break;
            case TYPE_ACTIVITY:
                msg+="停留";
                break;
            case TYPE_OUT:
                msg+="离开";
                break;
        }
        msg+="\n记录时间:"+ DateUtil.format(createDate,null);
        msg+="\n\n";
        return msg;
    }
}
